package com.easytext.resourcebundle.main;

import java.util.Locale;
import java.util.ResourceBundle;

/**
 * @author caifan
 * @created 2021/12/4
 * @description:
 */
public class Loader {
    public static void main(String... args) throws Exception {
        System.out.println(Locale.getDefault());
        String locale = args.length > 0 ? args[0] : "zh_CN";

        Locale l = Locale.forLanguageTag(Locale.CHINA.toLanguageTag());
        // 国际化
        ResourceBundle translations =
                ResourceBundle.getBundle("Translations", l);

        // maven项目的properties文件必须在resources目录下
        ResourceBundle bundle = ResourceBundle.getBundle("aaa");

        System.out.println(translations.getString("modularity_key"));
        System.out.println("Translation of modularity in : " + bundle.getString("name"));
    }
}
